<!DOCTYPE html>
<html>
<head>
    {include file="public/header" /}
</head>
<style>
    .layuimini-form > .layui-form-item > .layui-input-block {
        margin-left: 150px !important;
        margin-right: 50px;
    }
    .layuimini-form > .layui-form-item > .layui-form-label {
        width: auto !important;
    }
</style>
<body>
<div style="padding-bottom:200px" class="layui-form layuimini-form">

    <input type="hidden" name="mod_id" value="{$res.mod_id}" />

    <div class="layui-form-item">
        <label class="layui-form-label required">商品名称</label>
        <div class="layui-input-block">
            <input type="text"  value="{$res.bizpro.bizpro_name}"      disabled class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">订单状态</label>
        <div class="layui-input-block">
            <select name="data_status" lay-filter="show_type">
                <option {if condition="$res.bizpro.data_status==1"} selected {/if} value="1">已下单</option>
                <option {if condition="$res.bizpro.data_status==2"} selected {/if} value="2">未下单</option>
                <option {if condition="$res.bizpro.data_status==3"} selected {/if} value="3">已发货</option>
                <option {if condition="$res.bizpro.data_status==4"} selected {/if} value="4">已完成</option>
            </select>
        </div>
    </div>


    <div class="layui-form-item express" {if condition="$res.order_status  <= 2 "} style="display: none" {/if}>
    <label class="layui-form-label required">物流单号</label>
    <div class="layui-input-block">
        <input type="text"  value="{$res.express_code}" name="express_code" lay-verify="required" lay-reqtext="快递单号不能为空"   class="layui-input">
    </div>
</div>
<div class="layui-form-item express" {if condition="$res.order_status  <= 2 "} style="display: none" {/if}>
<label class="layui-form-label required">合作物流</label>
<div class="layui-input-block">
    <select name="logistic_id"  >
        <option value="">请选择合作物流</option>
        {volist name="express" id="vo"}
        <option {if condition="$vo.id == $res.logistic_id"} selected {/if} value="{$vo.id}">{$vo.title}</option>
        {/volist}
    </select>
</div>
</div>



<div class="layui-form-item">
    <div class="layui-input-block">
        <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
    </div>
</div>
</div>
{include file="public/footer" /}
<script>
    // 进入页面执行的方法


    let banner_url=[{$bannerurl}];

    $(function() {
        $('#form-tags-1').tagsInput({
            'delimiter': ',',
            placeholder: '添加标签,回车键添加下一个',
        });
    });
    layui.use(['form', 'laydate','upload'], function () {
        let form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {


            $.ajax({
                url: "/admin/OrderData/SaveStatus",
                type: 'post',
                async: true,
                data: data.field,
                dataType: 'json',
                success: function (res) {
                    if(res.status){
                        parent.layer.msg("操作成功!", {icon:1,time: 1000}, function () {
                            //重新加载父页面
                            parent.location.reload();
                        });
                        return;
                    }else{
                        layer.open({
                            title: '提示信息',
                            content: '<span style="color:red">'+res.code+':</span>'+res.msg
                        })
                        return false
                        // layer.msg(res.msg);
                    }

                },
                error: function(re) {

                    layer.open({
                        title: '提示信息',
                        // content: '<span style="color:red">'+re.responseJSON.errorCode+':</span>'+re.responseJSON.msg
                        content: '<span align="center" style="color:red">'+re.responseJSON.msg+'</span>'
                    })
                }
            });
            return false;
        });
        form.on('select(show_type)',function (data) {
            console.log(data)
            if(data.value==3){
                $(".express").attr('style','display:block');
            }else{
                $(".express").attr('style','display:none');
            }
        })
    });
</script>
</body>
</html>